//
//  String+Color.swift
//  CMCCIOTSwift
//
//  Created by isoftstone on 2017/4/18.
//  Copyright © 2017年 isoftstone. All rights reserved.
//

import Foundation
import UIKit
//MARK:- 扩展颜色
extension String{
    
    
    func uiColor() -> UIColor {
        var red:UInt32 = 0, green:UInt32 = 0, blue:UInt32 = 0
        
        // 分别转换进行转换
        Scanner(string: self[0..<2]).scanHexInt32(&red)
        
        Scanner(string: self[2..<4]).scanHexInt32(&green)
        
        Scanner(string: self[4..<6]).scanHexInt32(&blue)
        
        return UIColor(red: CGFloat(red)/255.0, green: CGFloat(green)/255.0, blue: CGFloat(blue)/255.0, alpha: 1.0)
    }
    
}
